package com.jl.obulibrary.sdk;


import com.example.libpos.GPIOControlLib;
import com.jl.obulibrary.driver.LocalPsamSerialDriver;
import com.jl.obulibrary.globalParameter.GlobalParameter;
import com.jl.obulibrary.servive.OperationByDSRC;
import com.jl.obulibrary.servive.OperationByPsam;
import com.jl.obulibrary.servive.OperationBySerialPort;

public class KeChuang_SDK {


    static GPIOControlLib gpio = new GPIOControlLib();



    public static int power(int state) {
        // TODO 模块上电

        gpio.writeGpioStatus(96, state);
        int ret =  gpio.writeGpioStatus(35, state);
        int ret2 = gpio.writeGpioStatus(36, state);
        int ret3 = gpio.writeGpioStatus(3, state);
        try {
            //必须延时300毫秒
            Thread.sleep(300);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return ret;
    }
    public static void Init() {
        RsuInit();
        PsamInit();
        PosInit();
        CustomInit();
    }

    public static void RsuInit() {
        OperationByDSRC.getInstance().initEtcPos();


    }
    public static void PsamInit() {
        OperationByPsam.getInstance().initEtcPsam();

    }
    public static void PosInit() {

        OperationByDSRC.getInstance().initPosRsu(GlobalParameter.RSU_IP, GlobalParameter.RSU_POWER) ;

    }
    public static void CustomInit() {

        OperationBySerialPort.getInstance().initRsuTrans(GlobalParameter.RSU_IP,  GlobalParameter.RSU_POWER);

    }





}
